package com.mvc4g.example.mockup.client.action;

import com.mvc4g.client.ActionInterface;
import com.mvc4g.client.Controller;
import com.mvc4g.example.mockup.client.Constants;
import com.mvc4g.example.mockup.client.view.templates.LoggedTemplate;
import com.mvc4g.example.mockup.client.view.templates.RootTemplate;
import com.mvc4g.example.mockup.client.view.views.AbstractView;

public class GoToWelcomePageAction implements Constants, ActionInterface {

	@Override
	public void execute(Controller controller, Object form) {

		LoggedTemplate loggedTemplate = (LoggedTemplate) controller
				.getView(LOGGED_TEMPLATE);

		RootTemplate rootView = (RootTemplate) controller
				.getView(ROOT_TEMPLATE);
		rootView.changePage(loggedTemplate, null);

		AbstractView welcomeView = (AbstractView) controller
				.getView(WELCOME_VIEW);
		loggedTemplate.changePage(welcomeView, GO_TO_WELCOME_PAGE);
	}

}
